package com.example.aopproxy.controller;

import com.example.aopproxy.component.ProxyFactory;
import com.example.aopproxy.component.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/student")
public class UserController {

    @Autowired
    private ProxyFactory proxyFactory;

    @RequestMapping("/study")
    public String study() {
        Student student = proxyFactory.getProxyObject();
        student.study();
        return "课堂学习";
    }

    @RequestMapping("/home")
    public String home() {
        Student student = proxyFactory.getProxyObject();
        student.doHomeWork();
        return "做家庭作业";
    }

}
